<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>廉政告知书(全局)</title>
  <link rel="stylesheet" href="/layui/v10/layui.css">
  <link rel="stylesheet" href="/css/custom.form.css">
  <style>
    .layui-input layui-unselect {
      cursor: pointer;
    }

    .layui-tab-content {
      margin-left: 10px;
    }

    .layui-table {
      width: 96%;
    }
  </style>
</head>
<body>
<div class="layui-tab table_div">
  <div class="layui-tab-content">
    <div class="layui-tab-item layui-show">
      <div>
        <div class="layui-form-item" style="margin-left: 20px">
          <div class="layui-input-inline">
            <label for="createTime"></label>
            <input type="text" readonly class="layui-input" id="createTime" placeholder="创建时间">
          </div>
          <div class="layui-input-inline ">
            <button class="layui-btn" onclick="searchLog()" id="search">查询</button>
          </div>
        </div>
        <table class="layui-table" id="logShowTable" lay-filter="logShowTable"></table>
      </div>
    </div>
  </div>
</div>

<div class="layui-tab table_div1" hidden>
  <div class="layui-tab-content">
    <div class="layui-tab-item layui-show">
      <div class="layui-form-item" style="margin-left: 10px">
        <div class="layui-btn layui-btn-primary" id="btn_cancel">返回</div>
      </div>
      <table class="layui-table" id="logShowTable1" lay-filter="logShowTable1"></table>
    </div>
  </div>
</div>

<script src="/layui/v10/layui.js"></script>
<script src="/js/core.util.js"></script>
<script th:inline="none">
  // 获取token
  let token = CoreUtil.getData("access_token");
  // 地址栏转义token中的#号
  let tokenQuery = token.replace("#", "%23");
  let logShowTable;
  let showTable;
  let table = layui.table;
  let form = layui.form;
  let layer = layui.layer;
  let $ = jQuery = layui.jquery;
  let laydate = layui.laydate;
  let upload = layui.upload;
  let element = layui.element;
  let maxlength = 500;
  let inspectionMan = "";
  let startTime = null;
  let endTime = null;
  layui.use(['table', 'layer', 'laydate', 'upload', 'element'], function () {
    //创建日期
    laydate.render({
      elem: '#createTime'
      , type: 'datetime'
      , range: '~'
      , done: function (value) {
        if (value !== null && value !== undefined && value !== "") {
          startTime = value.split("~")[0];
          endTime = value.split("~")[1];
        } else {
          startTime = null;
          endTime = null;
        }

      }
    });
    // 工作日志
    logShowTable = table.render({
      elem: '#logShowTable',
      contentType: 'application/json',
      headers: {
        "authorization": token
      },
      page: true,
      where: {
        "bz": 9
      },
      url: '/workflow/notification/LzgzsJztj',
      method: 'POST',
      parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
        return {
          "code": res.code, //解析接口状态
          "msg": res.msg, //解析提示文本
          "count": Array.isArray(res.data) ? res.data.length : 0, // 如果是数组，返回其长度
          "data": Array.isArray(res.data) ? CoreUtil.paramsDecrypt(res.data) : null // 如果是数组，解密数组内容
        }
      },

      cols: [[
        {
          align: 'center',
          width: 370,
          field: 'taxorg',
          title: '税务机关',
          sort: true,
        },  {
          align: 'center',
          width: 220,
          field: 'count',
          title: '合计',
          sort: true,
          event: 'type',
          style: 'cursor:pointer'
        }
      ]],
      toolbar: '#logToolbar'
    });
    // 工作日志
    logShowTable1 = table.render({
      elem: '#logShowTable1',
      contentType: 'application/json',
      headers: {
        "authorization": token
      },
      page: true // 开启分页
      ,
      url: '/workflow/notification/listtj' //数据接口
      ,
      method: 'POST',
      parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
        return {
          "code": res.code, //解析接口状态
          "msg": res.msg, //解析提示文本
          "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度
          "data": CoreUtil.isEmpty(res.data) ? null
                  : CoreUtil.paramsDecrypt(res.data.records)
        }
      },
      cols: [[
        {
          align: 'center',
          width: 230,
          field: 'jcajxxuuid',
          title: '稽查UUID',
          sort: true,
          hide: true
        }, {
          align: 'center',
          width: 140,
          field: 'notificationNo',
          title: '廉政编号',
          edit: "text",
          sort: true,
        }, {
          align: 'center',
          width: 205,
          field: 'jcajbh',
          title: '稽查案件编号',
          sort: true,
        }, {
          align: 'center',
          width: 210,
          field: 'nsrsbh',
          title: '纳税人识别号',
          sort: true,
        }, {
          align: 'center',
          width: 280,
          field: 'nsrmc',
          title: '纳税人名称',
          sort: true,
        }, {
          align: 'center',
          width: 200,
          field: 'field6',
          title: '税务检查通知书送达情况',
          sort: true,
        },
      ]],
      toolbar: '#toolbar'
    });
    // 个人待办表头工具
    table.on('toolbar(logShowTable)', function (obj) {
      switch (obj.event) {
        case 'addinspectionhear':
          addinspectionhear("0");
          break;
        case 'add':
          add();
          break;
      }
    });
    //查询具体数据
    table.on('tool(logShowTable)', function (obj) {
      let event = obj.event;
      let taxorgcode = obj.data.taxorgcode;
      if (event === "type1") {
        // 处理你的业务逻辑
        searchLog1("1", taxorgcode)
      } else if (event === "type2") {
        searchLog1("2", taxorgcode)
      } else if (event === "type") {
        searchLog1("", taxorgcode)
      }
    })
    // 返回
    $("#btn_cancel").click(function () {
      $(".table_div").show();
      $(".table_div1").hide();
      return false;
    });
  });

  function search() {
    showTable.reload({
      where: {},
      page: {
        curr: 1
      }
    });
  }

  function searchLog() {
    logShowTable.reload({
      where: {
        startTime: startTime,
        endTime: endTime,
      },
      page: {
        curr: 1
      }
    });
  }

  function searchLog1(_typeId, taxorg) {
    $(".table_div").hide();
    $(".table_div1").show();
    logShowTable1.reload({
      where: {
        type: _typeId,
        taxorgcode: taxorg,
        startTime: startTime,
        endTime: endTime,
        bz:"bmh"
      },
      page: {
        curr: 1
      }
    });
  }

  function back() {
    search();
    searchLog();
  }

</script>

</body>
</html>